package com.kevin.hw.zklock;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
 * @author: kevin
 * @date: 2017/8/14
 * @description:
 */
public class DistributeLockTest {




    public static void main(String[] args) throws InterruptedException {

        for (int i =0 ;i<10;i++){

            new Thread(() ->{

                DistributeLock distributeLock = null;

                try {
                    distributeLock = new DistributeLock();

                    distributeLock.lock();
                    TimeUnit.SECONDS.sleep(4);

                    distributeLock.unlock();

                } catch (IOException e) {
                    e.printStackTrace();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

            }).start();

        }

        TimeUnit.SECONDS.sleep(30);

    }
}
